<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<%@page import="org.edu.system.DBConnect"%>
<%
	String stu_id = (String) (session.getAttribute("UserName"));
	String sql = "SELECT * FROM student WHERE stu_id = '" + stu_id + "'";
	System.out.println(sql);

	Connection con = DBConnect.getCon();
	Statement stmt = null;
	ResultSet rs = null;
	stmt = con.createStatement();
	rs = stmt.executeQuery(sql);//执行命令
	if (rs.next())// 如果记录集非空，表明有匹配的用户ID
	{

		//正常进行
	} else {
		// 否则登录失败
		// response.sendRedirect ( "MyJsp.jsp" );
		response.sendRedirect("login_failure.jsp");
	}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="resultBean" class="mybean.selectBean" scope="request"/>
<html>
<head>
<link href="./bootstrap/css/bootstrap.min.css" rel="stylesheet">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>学生课表</title>
</head>
<body style="width:900px; margin:0 auto;">
<div id="header">
<table border="0" width="100%" frame="below" class="table table-striped table-bordered">
	<tr>
		<td width="80%" height="50px" style="padding-top:10px"><h1>学生考勤系统</h1></td>
		<td width="20%" style="text-align:right">您好啊!</td>
	</tr>
	<tr height="20px">
		<td>
			<table border="0" frame="hsides">
				<tr>
					<td width="80px"><a href="<%=request.getContextPath()%>/stu_qiandao.jsp">学生考勤</a></td>
					<td width="80px"><a href="<%=request.getContextPath()%>/stu_courselist.jsp">查课表</a></td>
					<td width="80px"><a href="<%=request.getContextPath()%>/stu_evaluation.jsp">教学评价</a></td>
				</tr>
			</table>
		</td>
		<td>
		<table  width="100%">
		<tr>
			<td style="text-align:right"><a href="stu_info.jsp">个人信息</a></td>
			<td style="text-align:right"><a href="stu_change_password.jsp">修改密码</a></td>
		</tr>
		</table>
		</td>
	</tr>
</table>
</div>
<br>
<div>
<table border=1>
      <tr>
		<th>课程 </th>
  		<th>时间 </th>
  		<th>地点 </th>
  		<th>老师 </th>
  		<th>学分 </th>
  </tr>
      	<tr>您的课表：
  <%  String [][] record = resultBean.getTableRecord();
      for(int i=0;i<record.length;i++) {
  %>
  <%     for(int j=0;j<record[i].length;j++) {
  %>        <td><%= record[i][j] %> </td>
  <%     }
  %>    </tr>
  <%  }
  %>
  </table>
 </div>
</font></body>
</html>
<!-- sssss  -->